using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BaHuan.Common;
using BaHuan.Entities;
using BaHuan.DataLayer;
/*
 * There are many processes that handle the flows of data
 * we call them business logic of a program.
 * For each of business logic process we create a class 
 * that handle for that process
 * 
 * */
namespace BaHuan.BusinessLayer
{
	
	public class PhieuNhapKhoMgt
	{
	
		public ResultObj SaveNewPhieuNhapKho(PhieuNhapKho phieunhapkho)
        		{
			ResultObj result = new ResultObj();
			phieunhapkho.Id = -1;
			PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
			result = phieunhapkhoDAO.SavePhieuNhapKho(phieunhapkho);
			
			return result;
		}
		
		public ResultObj UpdatePhieuNhapKho(PhieuNhapKho phieunhapkho)
        		{
			ResultObj result = new ResultObj();
			PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
			result = phieunhapkhoDAO.SavePhieuNhapKho(phieunhapkho);
			
			return result;
		}
		
		public ResultObj DeletePhieuNhapKho(PhieuNhapKho phieunhapkho)
        		{
			ResultObj result = new ResultObj();
			PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
			result = phieunhapkhoDAO.DeletePhieuNhapKho(phieunhapkho);
			
			return result;
		}
		
		public ResultObj GetAllPhieuNhapKho( )
        		{
			ResultObj result = new ResultObj();
			PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
			result = phieunhapkhoDAO.GetAllPhieuNhapKho();
			
			return result;
		}

        public ResultObj GetAllPhieuNhapKhoToCheckCode()
        {
            ResultObj result = new ResultObj();
            PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
            result = phieunhapkhoDAO.GetAllPhieuNhapKhoToCheckCode();

            return result;
        }
		
		public ResultObj GetPhieuNhapKhoById(PhieuNhapKho phieunhapkho)
        		{
			ResultObj result = new ResultObj();
			PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
			result = phieunhapkhoDAO.GetAllPhieuNhapKhoByID(phieunhapkho);
			
			return result;
		}

        public ResultObj GetPhieuNhapKhoByMaSo(PhieuNhapKho phieunhapkho)
        {
            ResultObj result = new ResultObj();
            PhieuNhapKhoDAO phieunhapkhoDAO = new PhieuNhapKhoDAO();
            result = phieunhapkhoDAO.GetAllPhieuNhapKhoByMaSo(phieunhapkho);

            return result;
        }
	}
}
